<template>
	<BaseContainer>
		<ProjectSelect belongProject="govBuyManage"></ProjectSelect>
		<aplid-base-crud   ref="crud" class="w-100" v-bind="{ ...baseConfig, ...$attrs }">
			<template v-slot:importDialog="{ row, show }">
				<ImportForm @refresh="handleRefresh" :api="baseConfig.api" :key="show" :nowRowData="row"></ImportForm>
			</template>

			<template v-slot:addDialog="{ row, show }">
				<TabForm @refresh="handleRefresh" :api="baseConfig.api" :key="show" :nowRowData="row"></TabForm>
			</template>
			<template v-slot:ArchivesDialog="{ row, show }">
				<Archives @refresh="handleRefresh" @rechange="handleOperate" :api="baseConfig.api" :key="show" :nowRowData="row"> </Archives>
			</template>
			<template v-slot:changeDataDialog="{ row, show }">
				<RechangeDetail @refresh="handleRefresh" v-if="show" :batchNumber="row.dataStatus"> </RechangeDetail>
			</template>

			<template v-slot:menuColumn="{ row }">
				<el-button v-if="row.dataStatus && row.dataStatus !== '0'" @click="handleOperate('changeData', row, '数据变更')" text type="warning">
					变更中
				</el-button>
			</template>
		</aplid-base-crud>
	</BaseContainer>
</template>

<script setup lang="ts">
import { baseConfig } from './config'
import ImportForm from './ImportForm/index.vue'
import TabForm from './TabForm/index.vue'
import Archives from './Archives/index.vue'
import RechangeDetail from '@/views/datacenter/components/DataGather/change/detail.vue'
import ProjectSelect from '@/views/homeCare/components/ProjectSelect/index.vue'

const crud = ref(null)
const handleRefresh = (query, visible = false) => {
	nextTick(() => {
		crud.value.refreshChange(query)
	})
}

const handleOperate = (type, row, title) => {
	nextTick(() => {
		crud.value.handleOperate(type, row, title)
	})
}
defineExpose({
	handleRefresh,
})
</script>

<style lang="scss" scoped></style>
